# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer:
pkgname=drone
pkgver=1.9.0
pkgrel=0
pkgdesc="Container-Native, Continuous Delivery Platform"
url="https://drone.io/"
arch="all !mips !mips64"
license="custom"
makedepends="go"
options="!check"
_commands="
	$pkgname-agent:_pkg
	$pkgname-controller:_pkg
	$pkgname-server:_pkg
	"
subpackages="
	$_commands
	$pkgname-doc
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/drone/drone/archive/v$pkgver.tar.gz"

export GOPATH="$srcdir"

build() {
	for pkg in $_commands; do
		GO111MODULE=on go build -o bin/${pkg%%:*} ./cmd/${pkg%%:*}
	done
}

package() {
	install -Dm 644 "$builddir"/LICENSE \
		"$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

_pkg() {
	pkgdesc="$pkgdesc ($subpkgname)"
	install_if="$pkgname"
	install -Dm775 "$builddir"/bin/$subpkgname \
		"$subpkgdir"/usr/bin/$subpkgname
}

cleanup_srcdir() {
	go clean -modcache
	default_cleanup_srcdir
}

sha512sums="3c2e2046a212f059b8ea7b6b0f8c5698d045391360eb20f6a254dc810aa5d0752098ed1916a1160239ad336d9b0543e05b1e9b556a99de99f95dc2d0cc3513c7  drone-1.9.0.tar.gz"
